import DList from "@/components/dlist";
export default {
  data() {
    return {
      activeName: 1,
      surplus_unlock_num: "",
      wait_unlock_num: 0,
      surplus_unlock_num: 0,
      freezeCouponData: [],
      loading: false,
      finished: false,
      page: 1
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    async getData() {
      if (this.loading === true || this.finished === true) {
        return;
      }
      this.loading = true;
      let { data, result, msg } = await $http.post("plugin.froze-coupon.frontend.member-froze-coupon.get-list", { page: this.page });
      console.log(data,'datadata');
      if (result) {
        this.wait_unlock_num = data.wait_unlock_num;
        this.surplus_unlock_num = data.surplus_unlock_num;
        this.freezeCouponData.push(...data.list.data);
        if (data.list.data.length === 0 || data.list.data.length < data.list.per_page || data.list.current_page === data.list.last_page) {
          this.finished = true;
        }
        this.page++;
        this.isShowDirect = true;
        this.loading = false;
      } else {
        this.$toast(msg);
      }
    },
    onLoad() {
      this.getData();
    },
  },
  components: { DList }
};
